﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Xml.Linq;
using SimpleServiceBus.Endpoint;
using SimpleServiceBus.Endpoints.Msmq;
using SimpleServiceBus.Endpoints.Msmq.Configuration;

namespace SampleAsyncWebClient
{
    public class Global : HttpApplication
    {
        public static IMessagingEndpoint Endpoint { get; private set; }

        protected void Application_Start(object sender, EventArgs e)
        {
            //The calls to EnsureQueue are just for the samples
            MsmqHelper.EnsureQueue("ManagedWebClient");
            MsmqHelper.EnsureQueue("EndpointMonitorService");
            
            //Here is the code required to start your endpoint
            //and make it globally accessible to other web pages.
            //The endpoint itself is threadsafe.
            var ep = MsmqEndpointConfiguration.CreateConfiguredEndpoint();
            ep.Start();

            Endpoint = ep;
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}